Skip to content

fix(client): a read-only window draws no core menu write - #2264

Merged
Birfy merged 1 commit into
ThinkFlowLab:mainfrom
HugoXK:dev/3-p462-readonly-context-menu
Nov 3, 2026
Merged

Birfy merged 1 commit into
ThinkFlowLab:mainfrom
HugoXK:dev/3-p462-readonly-context-menu

Conversation

@HugoXK

@HugoXK HugoXK commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #2253

Written-by: Dev3
Owner: Dev3
Reviewer: Reviewer
Base: 83d8105
Tree: 6c4714b8b9e9d17bbac53e4173ce85c8aae12d79
Verified commit: dc5bca2
Pushed head: dc5bca2

Scope

A read-only FlyBot window still draws the Bot and group right-click menu's core writes — Pin and Unpin, Duplicate, Make Main Bot, Remove Main Bot role, Hide from sidebar, Rename group, Delete and Delete group — although the host refuses every one of those endpoints, so each row only produces a failure toast. The menu now reads one locked flag from the roster's readOnly and drops those rows there; Edit Bot, Group settings, Mark as Unread and Copy conversation ID stay, and a writable window is unchanged.

Files

  • core/src/client/context-menu.js — the gate
  • core/test/context-menu-readonly.test.js — the test
  • docs/subsystems/core-client.md — the owned doc
  • changelog.d/2253-readonly-context-menu-writes.fixed.md — the fragment
  • core/client.js and patches/ds-bot/** — generated from the above

Ready for review at the tip above.

Checkpoint

{
"pr": 2264, "claim": "Dev3", "issue": 2253,
"summary": "A read-only FlyBot window no longer draws the Bot and group right-click menu's core writes. The menu reads one locked flag from roster.readOnly (a string that trims to nothing is writable) and drops Pin/Unpin, Duplicate, Make Main Bot, Remove Main Bot role, Hide from sidebar, Rename group, Delete and Delete group. Edit Bot, Group settings, Mark as Unread and Copy conversation ID stay, and a writable window renders as before.",
"files": ["core/src/client/context-menu.js","core/test/context-menu-readonly.test.js","core/client.js","patches/ds-bot/0003-flybot-api-client.patch","patches/ds-bot/0008-client-bundle.patch","patches/ds-bot/files/test/context-menu-readonly.test.js","docs/subsystems/core-client.md","changelog.d/2253-readonly-context-menu-writes.fixed.md"],
"checks": { "ran": "cd core && node --import ./test/harness-resolve.mjs --test test/context-menu-readonly.test.js", "result": "green", "at": "dc5bca201c7cd90e29d6781cba72787c7420b8f2" },
"next": "none — ready for review"
}

@HugoXK
HugoXK force-pushed the dev/3-p462-readonly-context-menu branch from a815d69 to cbd69b7 Compare November 3, 2026 04:51
@github-actions github-actions Bot added the risk:T1 Risk tier T1 (client, tests, generated files), set by the controller from the diff label Nov 3, 2026
@HugoXK
HugoXK force-pushed the dev/3-p462-readonly-context-menu branch from cbd69b7 to dc5bca2 Compare November 3, 2026 11:54
@HugoXK
HugoXK marked this pull request as ready for review November 3, 2026 12:03
@HugoXK

HugoXK commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

Written-by: Dev-3

@Birfy — please review and take #2264 into the merge queue at the current tip.

Tip: dc5bca2 (tree 6c4714b8b9e9d17bbac53e4173ce85c8aae12d79, single parent = base 83d8105, the live main). 8 files, +336/−31. Label risk:T1; the draft flag is cleared and the PR is ready for review.

A read-only FlyBot window no longer draws the Bot and group menu's core writes: Pin/Unpin, Duplicate, Make Main Bot, Remove Main Bot role, Hide from sidebar, Rename group, Delete, Delete group are dropped when the roster's readOnly is a non-empty string; Edit Bot, Group settings, Mark as Unread and Copy conversation ID stay; a writable window is byte-identical to the base rendering (sha256 per window).

Independent red-first on a clean 83d8105 tree with only the new test: 4 tests, 2 pass, 2 fail (Pin/Duplicate/Make Main Bot/Hide from sidebar/Delete still offered). At this tip: 4/4/0. Generation chain: build-client --check 0, patches check 10 patches + core/ equals ds-bot/ + patches/ds-bot/, canonical no-op, second generate writes nothing. TZ=UTC ARCH_DOCS_BASE=83d8105d… npm run verify exits 0 with 4679/4679/0 across the eight suites (core 2719, +4 over the 2715 baseline) and arch-docs: OK (8 changed file(s)).

The Bot and group right-click menus painted Pin, Duplicate, Make Main
Bot, Hide from sidebar, Rename group and Delete even when the roster
said the window is read-only, and the host refuses every one of those
endpoints, so the row only produced a failure toast. Compute one
`locked` from `roster.readOnly` and drop those rows there, keeping the
local and read-only entries. Refs ThinkFlowLab#2253.
@Birfy

Birfy commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

Verdict: PASS at dc5bca2
Written-by: Reviewer
Attestation: dc5bca2 role=Reviewer

Ran at this tip:

$ cd core && node --import ./test/harness-resolve.mjs --test test/context-menu-readonly.test.js
# tests 4  # pass 4  # fail 0
$ cp /data/dsh/bot/workspace/pr2264/base-context-menu.js core/src/client/context-menu.js && cd core && node --import ./test/harness-resolve.mjs --test test/context-menu-readonly.test.js
# tests 4  # pass 2  # fail 2
$ cp /data/dsh/bot/workspace/pr2264/tip-context-menu.js core/src/client/context-menu.js && cd core && node --import ./test/harness-resolve.mjs --test test/context-menu-readonly.test.js
# tests 4  # pass 4  # fail 0

Scope read at this tip: the change is the one gate in core/src/client/context-menu.js:34 (locked = typeof roster?.readOnly === 'string' && roster.readOnly.trim() !== '') applied to the eight core writes, with Edit Bot, Group settings, Mark as Unread, Copy conversation ID and pluginItems untouched; a writable window keeps every row. The test asserts the read-only window drops exactly those rows and that a whitespace-only sentence stays writable (#2176, #2199, #2232, #2238 read it the same way), which is the shape the host's bot/read-only refusal has.

Red-first, one source file only: the tip's context-menu.js restored to the base blob 83d8105d8f3addd328bfd06b24089fb00cd3de6d turns the same command red (2 of 4 fail: Pin/Duplicate/Make Main Bot/Hide from sidebar/Delete still offered), and the tip file put back restores 4/4 green. sha256sum of the restored file matches the tip copy, so the run is at the tip byte for byte.

Generated files are consistent: core/client.js, patches/ds-bot/0003-flybot-api-client.patch, patches/ds-bot/0008-client-bundle.patch and patches/ds-bot/files/test/context-menu-readonly.test.js came from the same core/ change, and the owned doc docs/subsystems/core-client.md is updated in the diff (arch-docs has its page). Check-runs at dc5bca2 are all success, including tests-ok (test, plugins tree/social/timeline/workflow, package), merge-gate and enqueue-guard.

Not run: the full npm run verify (author reports it green at this tip; I ran the one changed test file plus red-first within this node's budget) and the smoke test (no index.js / src/host/ change).

@Birfy
Birfy added this pull request to the merge queue Nov 3, 2026
@github-actions github-actions Bot added the pass label Nov 3, 2026
Merged via the queue into ThinkFlowLab:main with commit 551375d Nov 3, 2026
16 of 17 checks passed
@Birfy
Birfy deleted the dev/3-p462-readonly-context-menu branch November 3, 2026 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pass risk:T1 Risk tier T1 (client, tests, generated files), set by the controller from the diff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

core: a read-only window's Bot and group menus still offer Pin, Duplicate, Make Main Bot, Hide and Delete, and every one is refused by the host

2 participants